﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Entity
{

    public class SearchRK_Lock_Log : RK_Lock_Log
    {
        public string mchname { get; set; }

        public string bname { get; set; }
    }
    public enum lock_enum
    {
        关闭 = 1,
        开启 = 2
    }
    public class RK_Lock_Log
    {
        /// <summary>
        ///  锁ID
        /// </summary>
        public string lock_id { get; set; }
        /// <summary>
        ///  机器ID
        /// </summary>
        public string mchid { get; set; }
        /// <summary>
        ///  机器SN
        /// </summary>
        public string sn { get; set; }
        /// <summary>
        /// 电磁锁使能标志，0-关闭此功能，1-开启此功能，在0的状态下，所有设置无效。
        /// </summary>
        public int ElecEn { get; set; }
        /// <summary>
        /// 需要打开哪个电磁锁，0表示1通道，1表示2通道
        /// </summary>
        public int ElecNum { get; set; }
        /// <summary>
        /// 电磁锁通电时间，取值3-50，对应0.3s-5s
        /// </summary>
        public int ElecOnTi { get; set; }
        /// <summary>
        /// 对应通道电磁锁的状态，0表示没有通电，1表示已通电。
        /// </summary>
        public int ElecState { get; set; }
        /// <summary>
        /// 货柜编号 0是主柜 其余递推
        /// </summary>
        public int boxno { get; set; }
        /// <summary>
        /// 电控锁没有通电前初始状态，1-关闭，2-开启
        /// </summary>
        public int? lockinit { get; set; }
        /// <summary>
        /// 电控锁没有开启前锁盒门初始状态，1-关闭，2-开启
        /// </summary>
        public int? doorinit { get; set; }
        /// <summary>
        /// 电控锁通电后电控锁状态，1-关闭，2-开启
        /// </summary>
        public int? locknow { get; set; }
        /// <summary>
        /// 电控锁通电后锁盒门状态，1-关闭，2-开启
        /// </summary>
        public int? doornow { get; set; }
        /// <summary>
        /// 发送指令时间 
        /// </summary>
        public DateTime sendtime { get; set; }
        /// <summary>
        /// 收回指令时间
        /// </summary>
        public DateTime? receivetime { get; set; }
        /// <summary>
        /// 锁日志状态
        /// </summary>
        public lock_log_state lock_log_state { get; set; }
        /// <summary>
        /// 开锁描述
        /// </summary>
        public string msg { get; set; }
        /// <summary>
        /// 所属商户
        /// </summary> 
        public string baseuserid { get; set; }
        /// <summary>
        ///  操作人
        /// </summary>
        public string rk_userid { get; set; }
        /// <summary>
        /// 上传的开锁类型
        /// </summary>
        public int? opentype { get; set; }
        /// <summary>
        /// 服务器判断的开锁类型
        /// </summary>
        public int? server_opentype { get; set; }

        public int? lockclose { get; set; }

        public int? doorclose { get; set; }

        public string closemsg { get; set; }

        public lock_log_closestate lock_log_closestate { get; set; } = lock_log_closestate.未知;
        /// <summary>
        /// 关锁时间
        /// </summary>
        public DateTime? close_time { get; set; }
        /// <summary>
        ///  服务器判断关锁类型 1电控 2机械
        /// </summary>
        public int? server_closetype { get; set; }
    }
    public enum lock_log_state
    {
        已发送 = 0,
        电控开锁 = 1,
        电控关锁 = 2,
        机械开锁 = 3,
        机械关锁 = 4,
        异常 = 10,
        超时 = 11,
        未知= 12
    }

    public enum lock_log_closestate
    {
        未知 = 0,
        已关锁 = 1,
        未关锁 = 2,
        部分关锁 = 3
    }
    /// <summary>
    /// 发送开锁指令
    /// </summary>
    public class open_lock_params
    {
        public string msgid { get; set; }
        /// <summary>
        /// 电磁锁使能标志，0-关闭此功能，1-开启此功能，在0的状态下，所有设置无效。
        /// </summary>
        public int ElecEn { get; set; } = 1;
        /// <summary>
        /// 需要打开哪个电磁锁，0表示1通道，1表示2通道
        /// </summary>
        public int ElecNum { get; set; } = 0;
        /// <summary>
        /// 电磁锁通电时间，取值3-50，对应0.3s-5s
        /// </summary>
        public int ElecOnTi { get; set; } = 7;
        /// <summary>
        /// 对应通道电磁锁的状态，0表示没有通电，1表示已通电。
        /// </summary>
        public int ElecState { get; set; } = 1;
        /// <summary>
        ///  开启柜号
        /// </summary>
        public int boxno { get; set; }
    }
    public class receive_lock_params
    {
        public string msgid { get; set; }
        /// <summary>
        ///  柜体编号
        /// </summary>
        public int? boxno { get; set; }

        public string sn { get; set; }
        /// <summary>
        ///  电控锁没有通电前初始状态，1-关闭，2-开启
        /// </summary>
        public int? lockinit { get; set; }
        /// <summary>
        ///  电控锁没有开启前锁盒门初始状态，1-关闭，2-开启
        /// </summary>
        public int? doorinit { get; set; }

        /// <summary>
        /// 电控锁通电后电控锁状态，1-关闭，2-开启
        /// </summary>
        public int? locknow { get; set; }
        /// <summary>
        /// 电控锁通电后锁盒门状态，1-关闭，2-开启
        /// </summary>
        public int? doornow { get; set; }

        public int? opentype { get; set; }
    }
    /// <summary>
    /// 定义关锁参数
    /// </summary>
    public class receive_close_lock_params
    {
        public string msgid { get; set; }
        /// <summary>
        ///  柜体编号
        /// </summary>
        public int? boxno { get; set; }

        public string sn { get; set; }

        public int? lockclose { get; set; }

        public int? doorclose { get; set; }
    }
    public class lock_List_Params
    {
        public string mch_id { get; set; }
        public string mch_name { get; set; }
        public string mch_sn { get; set; }

        public int? server_opentype { get; set; }

        public string SendTime_sdt { get; set; }
        public string SendTime_edt { get; set; }
        /// <summary>
        /// 是否需要分页
        /// </summary>
        public bool? IsPage { get; set; } = true;
        /// <summary>
        ///  当前页数
        /// </summary>
        public int? page { get; set; } = 1;
        /// <summary>
        /// 单页数量
        /// </summary> 
        public int? pagesize { get; set; } = 100;
    }
}
